﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@page import="com.ufida.ebscg.comm.Constant"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<jsp:include page="../checksession.jsp"></jsp:include>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>招商银行供应商门户-采购创造价值_商务协同_商务应答_执行中项目_其他应答_澄清文件应答</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<link href="../css/style_add.css" rel="stylesheet" type="text/css" />
<link href="css/collcss.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript" src="../calendar/WdatePicker.js"></script>
<script language="JavaScript" type="text/javascript" src="../javascript/caltimer.js"></script>
<script language="JavaScript" type="text/javascript" src="../javascript/ajaxdeal.js"></script>
</head>

<body style="width:610px">
<div id="main">
<%if(Constant.CAOPEN){ %>
<OBJECT id="CertSignAtl"  height="0" hspace="0" width="0" align="center" classid="clsid:4FEA81CE-00EA-4FB2-850E-353C947B7A66" VIEWASTEXT>
</OBJECT>  
<%} %>
<!--右侧内容开始-->
<div id="right" >
<table width="610" border="0">
  <tr>
    <td height="30" class="f-12-333333">项目名称：<span class="f-16-b-000000">${project.proj_name}</span></td>
  </tr>
</table>

  <table width="620" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="13"><img src="images/yingda_zbj_001.jpg" width="13" height="76" border="0" /></td>
      <td width="70" background="images/yingda_zbj_002.jpg"><img src="images/yingda_z_001.jpg" width="64" height="63" border="0" /></td>
      <td width="215" valign="top" background="images/yingda_zbj_002.jpg"><table width="215" border="0" cellpadding="0" cellspacing="0" height="62">
        <tr>
          <td height="36"  colspan="8" valign="middle" class="f-14-e57c00">距离应答截止日期还有</td>
        </tr>
        <tr>
           <td width="26" align="center" bgcolor="#e57c00" class="f-20-b-ffffff" id="day"></td>
                <td align="center" class="f-14-b-000000">天</td>
                <td width="27" align="center" bgcolor="#e57c00" class="f-20-b-ffffff" id="hour"> </td>
                <td align="center" class="f-14-b-000000">时</td>
                <td width="27" align="center" bgcolor="#e57c00" class="f-20-b-ffffff" id="minute"></td>
                <td align="center" class="f-14-b-000000">分</td>
                <td width="27" align="center" bgcolor="#e57c00" class="f-20-b-ffffff" id="second"></td>
                <td align="center" class="f-14-b-000000">秒</td>
        </tr>
      </table></td>
      <td width="10" align="left" background="images/yingda_zbj_002.jpg"><img src="images/yingda_zbj_004.jpg" width="1" height="57" border="0" /></td>
      <td background="images/yingda_zbj_002.jpg" class="f-12-F60000">注意：请在应答截止时间前进行应答，超过应答截止时间后进行的应答操作为无效操作！</td>
      <td width="13"><img src="images/yingda_zbj_003.jpg" alt="" width="13" height="76" border="0" /></td>
    </tr>
  </table>
  <table width="610" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="128" height="15" ></td>
      <td width="176" ></td>
      <td width="96" ></td>
      <td width="210" ></td>
    </tr>
   	<tr>
          <td height="35" align="right">文件标题：&nbsp;</td>
          <td align="left">${steppub.release_title }</td>
          <td align="right"> 响应截止日期：&nbsp;</td>
          <td align="left">${steppub.bid_end_ts }</td>
        </tr>
        <tr>
          <td height="35" align="right">发布时间：&nbsp;</td>
          <td align="left">${steppub.release_date }</td>
          <td height="35" align="right">发布机构：&nbsp;</td>
          <td align="left">${steppub.pk_corp}</td>
        </tr>
        <tr>
         
          <td align="right">发布人：&nbsp;</td>
          <td align="left" colspan='3'>${steppub.pk_person }</td>
        </tr>
    

     <tr>
      <td align="right" valign="top">内容：&nbsp;</td>
      <td colspan="3" align="left" valign="bottom"><div style="height:80px; overflow:auto;">
        <p>${steppub.release_text }</p>
        <p>&nbsp;</p>
      </div></td>
    </tr>
  </table>

  
  <span style="font-size:14px;color:red">${dealmessage}</span>
  <input type="hidden" value = "${steppub.status}" id="status"/>
  <form name="downfile" method="post">
  <input type="hidden" name="filename" id="filename"/>
  <table width="610" border="0" cellpadding="0" cellspacing="0">
   <tr>
      <td height="35" align="center" class="f-13-b-2a6ca7" >下载采购文件</td>
      <td align="center" >&nbsp;</td>
      <td align="center" >&nbsp;</td>
      <td align="center" >&nbsp;</td>
      <td align="center" >&nbsp;</td>
    </tr>
    <tr class="th_bj">
      <td width="121" height="28" align="center" class="f-12-b-ffffff"  >序</td>
      <td width="146" height="28" align="center"  ><span class="f-12-b-ffffff">文件名称</span></td>
      <td width="111" height="28" align="center"  ><span class="f-12-b-ffffff">备注</span></td>
      <td width="132" height="28" align="center"  ><span class="f-12-b-ffffff">下载</span></td>
      <td width="100" height="28" align="center" class="f-12-b-ffffff"  >签名</td>
    </tr>
    
    <logic:notEmpty name="filelists" >
    
    <logic:iterate id="filelist" name="filelists">
    <tr>
      <td height="35" align="center" >1</td>
      <td align="center" >${filelist.att_name }</td>
      <td align="center" >&nbsp;</td>
      <td align="center" ><img src="../images/botton_downloading.jpg" width="59" height="21" border="0" 
      onclick=<%if(Constant.CAOPEN){%>"downfilefunction('other.do?type=4&pk_da_att=${filelist.pk_da_att}&pk_xy_proj_main=${pk_xy_proj_main}&pk=${steppub.pk_xy_step_pub}','${filelist.att_name}')"<%}else{%>"downfilefunction('other.do?type=4&pk_da_att=${filelist.pk_da_att}&pk_xy_proj_main=${pk_xy_proj_main}&pk=${steppub.pk_xy_step_pub}','${filelist.att_name}')"<%} %> style="cursor:hand" /></td>
      <td align="center" ><img src="../images/botton_signature-.jpg" width="59" height="21" border="0"  onclick="supquoteSign('other.do?type=5&pk_da_att=${filelist.pk_da_att}&pk_xy_proj_main=${pk_xy_proj_main}&pk=${steppub.pk_xy_step_pub}')" style="cursor:hand"/></td>
    </tr>
    </logic:iterate>
    </logic:notEmpty>
    <tr>
      <td colspan="5" height="1" bgcolor="#7f98ae"></td>
    </tr>
    <tr>
      <td height="25" colspan="5" >&nbsp;</td>
    </tr>
    <tr>
      <td colspan="5" height="1" class="xian"></td>
    </tr>
  </table>
  <p class="protext" id="div_content" name="div_content"><br/>
</p>
 
<!--右侧内容结束-->
<!--页面主体内容结束-->
</form>

<!--  <div style="width:100%" align="center">
  <div style="width:100%;border-width:1px;border-style:dashed;border-color:blue;" align="center">-->
<!-- <div  style="width:100%;line-height:6mm;cursor:hand" class="f-13-b-2a6ca7" onclick="onshowdiv(this)"  align="left" > -->
<!--<div  style="width:100%;line-height:6mm;cursor:hand" class="f-13-b-2a6ca7"  align="left" >
第一步：文件加密（请将所有需上传附件先行加密）
</div>

<div id="jiam" >
			<font style="font-size:12px; color:red ">请选择文件:    </font>
			<input type="file" name="file" onchange="upfileSign(this,0)" size="200px" />
			<p></p>
			<div id="msgid" style="color:red;font-size:12px; width:400px;line-height:6mm" align="left">
			</div>
</div>
</div>
</div>
-->


<form action="other.do?type=8&pk_xy_proj_main=${pk_xy_proj_main}&pk=${pk}" id='submitdata' enctype="MULTIPART/FORM-DATA" method ="post" name="insertPriceItemForm">
<div style="width:100%;border-width:1px;border-style:dashed;border-color:blue;margin-top:20px" align="center">
     <table width="610" border="0" cellpadding="0" cellspacing="0" height="120" class="xian" >
    <tr>
      <td valign="middle">

      <table width="610" border="0" cellpadding="0" cellspacing="0" id="fileuploadtable">
      <tr>
      <td height="50" align="left" class="f-13-b-2a6ca7" colspan='4'>第一步：上传采购文件(上传采购文件时，必须将报价文件、技术商务文件分开独立上传，技术商务文件中如含有任何价格信息，我行有权视为无效响应，一切后果由供应商自行承担)
      </td>
      </tr>
      <tr>
      <td height="50" align="left" class="f-13-b-2a6ca7" colspan='4'>
		<p style="font-size:10pt;color:red;margin-top:5px">提示：如果在添加上传文件时无法选择文件或上传文件不成功，请先参照首页公告下的相关文件上传操作手册对浏览器进行设置后再行操作！</p>
      </td>
      </tr>
      <tr class="th_bj">
            <td width="100" height="28" align="center" class="f-12-b-ffffff"  >序</td>
            <td width="320" height="28" align="center"  ><span class="f-12-b-ffffff" >文件名称</span></td>
            <td align="center" width='100px'><span class="f-12-b-ffffff" >附件类型</span></td>
            <td height="28" width = 100px; align="center" class="f-12-b-ffffff"  ><img src="../images/botton_add.jpg"  border="0" onclick = "addRow()"  style="cursor:hand"/></td>
      </tr>
      </table>
      </td>
    </tr>
  </table> 
      </div>
 <span>&nbsp</span>
   <table width="610" border="0" cellpadding="0" cellspacing="0" >
	   <tr>
	      <td height="26" align="left" class="f-13-b-2a6ca7" colspan='2'>已上传采购文件列表</td>
	 
	    </tr>
	    
	    <tr class="newth_bj">
	      <td width="10%"   height="28" align="center" class="f-12-b-ffffff"  >序</td>
	      <td width="50%"  height="28" align="center"><span class="f-12-b-ffffff">文件名称</span></td>
	      <td width="20%"  height="28" align="center"><span class="f-12-b-ffffff">附件类型</span></td>
	      <td width="20%"  height="28" align="center"><span class="f-12-b-ffffff">操作</span></td>
	    </tr>
	    
	    <logic:iterate id="att" name="atts">
	    <tr >
	      <td width="10%"   height="28" align="center"   >${att.index }</td>
	       <td width="50%"  height="28" align="center">${att.filename }</td>
	       <td width="20%"  height="28" align="center">${att.pub_type_name }</td>
	      <td id="${att.pk_da_att}" class ="center" width="200px"><img src="../images/botton_delete.jpg" style='cursor:hand' border=0 onclick="deleteFile('${att.pk_da_att}',${dismill})" style="border-width:0"/></td>
	    </tr>
	     <tr>
	      <td colspan="2" height="1" bgcolor="#7f98ae"></td>
	    </tr>
	    </logic:iterate>
	   
	  
	  </table>  

<span></span>
	<table width="610" border="0" cellpadding="0" cellspacing="0">
		
			<tr>
				<td colspan='2'>&nbsp;</td>
			</tr>
			
		    <tr>
		          <td width="12%" align="left" valign="top">说明：</td>
		          <td width="88%"><textarea name="memo" id="textarea2" cols="68" rows="10">${memo}</textarea></td>
		    </tr>
	</table>
	
	
	<table width="610" border="0" cellpadding="0" cellspacing="0">
	    <tr>
	      <td width="230" height="40">&nbsp;</td>
	      <td width="82"><img src="../images/botton_submit.jpg" width="60"  style="cursor:hand" height="20" border="0" onclick="submitValue()"/></td>
	      <td width="102"><img src="../images/botton_cancellation .jpg" width="60" style="cursor:hand" height="20" border="0" onclick="resetValue()"/></td>
	      <td width="196">&nbsp;</td>
	    </tr>
	</table>
</form>
 </div>
 

<TEXTAREA id="certtxt" name="certtxt" rows="17" cols="48"  style="display: none" >${cert}</TEXTAREA>

<script language="vbscript">

		function downandsign(url,filename)
			
		Dim strPlaintext
		Dim strSignature
		Dim strCert
		Dim ret
			
		ret = 0 rem ret 必须赋初值
		
		if IsNull(CertSignAtl) = True then
			alert("请确认您是否有权限下载文件")
			return
		end if
		
		CertSignAtl.SignData ret, filename, strSignature
		
		If ret = 0 Then
				call downfilefunction(url,strSignature)
		ElseIf ret = 100 Then
				
		Else
				Alert("下载文件出现问题")
		End If

		end function


	 sub upfileSign(fileobject,index)

			Dim strP7Env
			Dim strSignature
			Dim strCert
			Dim ret
            Dim filepath
			Dim objvalue

 			objvalue = 	 checkFileType(fileobject)
			if objvalue = 0 Then
			      return
			end if

			

           
            filepath = fileobject.value
			ret = 0 rem ret 必须赋初值
			
			
		   	if IsNull(CertSignAtl) then
					Alert("请确认您是否有权限上载文件")
					return
			end if


			   CertSignAtl.P7EncryptAndSignFile ret,certtxt.value,filepath,strP7Env,strSignature

				
			     If ret = 0 Then
				       call schange(fileobject,strP7Env,strSignature)
		
			     Else
					showmess("加密失败,请重新选择附件！")
			     End If
           

		end sub

</script>

<script language = "javascript">


parent.hideHideFun();

var message = "${message}";
if(message != ""){
	parent.showHideFun();
	parent.changeShowMessage(message,'yes','ok');	
}
var update_mode = '${update_mode}';

var ranMsg = new randomMsg();

function onshowdiv(divobj){

	
	var obj = document.getElementById("jiam");
	
	if(obj != null){
		if(obj.style.display == "none"){
			obj.style.display = "";	
			divobj.innerHTML = "第一步：文件加密(隐藏-)";
		}else{
			obj.style.display = "none";
			divobj.innerHTML = "第一步：文件加密(展开+)";
		}
	}
}

/*
判断删除附件需要验证附加是否已经关闭
*/
function deleteFile(attpk,distance)
{
	var pk_xy_proj_main = "${pk_xy_proj_main}";
	var pk_xy_step_pub = "${pk}";
	var url = "uploadfile.do?type=4&attpk="+attpk+"&pk_xy_proj_main="+pk_xy_proj_main+"&pk_xy_step_pub="+pk_xy_step_pub+"&"+Math.random();
	ajax(url,returnFunctions);
}

function returnFunctions(result)
{
	
	if(result != null)
	{
		var results = result.split(",");
		if(results[0] == "ok")
		{
			deleteAttFile(results[1],${dismill});
		}else
		{
			parent.showHideFun();
			parent.changeShowMessage("项目已经完成或者已经截止，无法删除附件!",'yes','ok');	
		}
	}else
	{
		parent.showHideFun();
		parent.changeShowMessage("项目已经完成或者已经截止，无法删除附件!",'yes','ok');	
		
	}
}


function downfilefunction(url,filename)
{
	//判断此环节是否在执行中和此环节是否已经应答结束
	var status = document.getElementById("status");

	
	//判断供应商是否在使用状态
	if(update_mode != '1')
	{
			showmess("供应商已经被淘汰或是废弃不能添加报价信息!");
			return;
	}
	
	if(change.distance >0 && status.value == '3')
	{
		document.downfile.filename.value = filename;
		document.downfile.action = url;
		
		document.downfile.submit();
	}
	
}
function SignFlag()
{
	this.flag = 1;
}
var sign = new SignFlag();
//使用ajax调用签名方法
function supquoteSign(url)
{
	var status = document.getElementById("status");
	
	//判断供应商是否在使用状态
	if(update_mode != '1')
	{
			showmess("供应商已经被淘汰或是废弃不能添加报价信息!");
			return;
	}
	
	if(change.distance >0 && status.value == '3')
	{
		
		parent.showHideFun();
		parent.changeShowMessage("开始签名!");
			sign.flag = 2;
			ajax(url,returnFunction);
		
	}
}

//提交应答信息
function submitValue()
{
	var status = document.getElementById("status");
	var pub_types = document.getElementsByName("pub_type");
	//判断供应商是否在使用状态
	if(update_mode != '1')
	{
			showmess("供应商已经被淘汰或是废弃不能添加报价信息!");
			return;
	}

	if(pub_types != null && typeof(pub_types) == 'object'){

		var length = pub_types.length;
		for(var index=0; index<length; index++){

				if(pub_types[index].value == ''){
					showmess("请选择上传加密投标文件类型!");
					return;
				}
		}
	}
	
	if(change.distance >0 && status.value == '3')
	{
		parent.showHideFun();
		parent.changeShowMessage("数据处理中,请等候.....");
		document.submitdata.submit();
	}else
	{
		showmess("应答已过期或完成无法提交数据!");
	}
}

//清空应答数据
function resetValue()
{
	
	document.all("textarea2").value='';
}

function returnFunction(value)
{

	if(value != null)
	{
		if(value == "ok")
		{
			parent.changeShowMessage("签名成功!",'yes','ok');	
		}else
		{
			parent.changeShowMessage("签名失败!",'yes','ok');	
		}
	}else
	{
		parent.changeShowMessage("签名失败!",'yes','ok');	
		
	}
}


var change  = new timechange();
//设置时间长度
change.setDistance(${dismill});
wakeInterval();

var rowindex = 0;
var temprowindex=0;
//向批量上传文件的列表中添加一行数据
function addRow()
{
	var submitstate = document.getElementById("status");
	if(submitstate.value != '3'){
	
		showmess("应答已经结束不能进行应答!");
		return 0;
	}
	if(change.distance <= 0 ){
	
		showmess("应答已经过期不能进行应答!");
		return 0;
	}
	
	//判断供应商是否在使用状态
	if(update_mode != '1')
	{
			showmess("供应商已经被淘汰或是废弃不能添加报价信息!");
			return;
	}
	
	if(change.distance > 0 && submitstate.value == '3')
	{
     var root = document.all("fileuploadtable")
     var row = root.insertRow();
     
     row.style.height = '26px';
     rowindex++;
     temprowindex++;
     row.id = "row"+rowindex;
     var cell1 = row.insertCell();
     
     cell1.align="center";
     cell1.innerText = temprowindex;
     var cell2 = row.insertCell();
     
     cell2.align="center";
     
     
	
	 var cell4= row.insertCell();
     
    
     //var eventHandle = "<%if(Constant.CAOPEN){ %>upfileSign(this,"+rowindex+")"<%}else{%>ondatachange(this,"+rowindex+")"<%}%>;
     var eventHandle = <%if(Constant.CAOPEN){ %>"FileChange(this,"+rowindex+")"<%}else{%>"FileChange(this,"+rowindex+")"<%}%>;
     
     //var eventHandle = "onsrcFileChange(this,"+rowindex+")";
    	
     var innercontent = "<input type='file'  name='inputfile"+rowindex+"' id='file"+rowindex+"' style='position:absolute;opacity:0;filter:alpha(opacity=0); width:20px; height:20px' onchange='"+eventHandle+"' />";

     var pub_type_inner = "<select name='pub_type' value=''><option value=''></option><option value='1'>报价文件</option><option value='2'>技术商务文件</option></select>&nbsp;";
     cell4.innerHTML = innercontent+pub_type_inner;

     var cell3 = row.insertCell();
     
      
     cell3.align="center";
     
     var img = "<input type='hidden' name = 'filecontent' id='filecontent"+rowindex+"'  /><input type='hidden' name='filename' id='filename"+rowindex+"' /><input type='hidden' name='signfile' id='signfile"+rowindex+"'/><img src='../images/botton_upload-.jpg' id='img"+rowindex+"' style='cursor:hand' border=0 style='cursor:hand'  onmouseover='showfiledialog("+rowindex+")'/>&nbsp<img src='../images/botton_delete.jpg' style='cursor:hand' border=0 style='cursor:hand' onclick='deleteRow("+rowindex+")'/>";
     cell3.innerHTML = img;  
     } 
}


//删除上传文件
function deleteRow(index)
{
	var root = document.all("fileuploadtable");
	var row = "row"+index ;
	
	var rows = root.rows;
    var deletepos = 0;
    
    
    //寻找到对应的删除行并进行删除
	for(var pos = 0; pos < rows.length; pos++)
	{
		var temprow = rows[pos];
		if(temprow.id == row)
		{
			root.deleteRow(pos);
			deletepos = pos;
			temprowindex--;
			break;
		}
	}
	
	
	//当删除行操作时更新显示索引
	for(var pos = deletepos; pos < rows.length; pos++)
	{
		var temprow = rows[pos];
		var cells = temprow.cells;
		
		var cell = cells[0];
		
		if(typeof(cell) == 'object')
		{
			cell.innerText = deletepos-1;
			deletepos++;
		}
	}	

}

//删除添加附件出错之后的连接
function deleteUpRow(row)
{
	var root = document.all("fileuploadtable");
	//var row = "row"+index ;
	
	var rows = root.rows;
    var deletepos = 0;
    

    
    //寻找到对应的删除行并进行删除
	for(var pos = 0; pos < rows.length; pos++)
	{
		var temprow = rows[pos];
		if(temprow.id == row)
		{
			root.deleteRow(pos);
			deletepos = pos;
			temprowindex--;
			break;
		}
	}
	//当删除行操作时更新显示索引
	for(var pos = deletepos; pos < rows.length; pos++)
	{
		var temprow = rows[pos];
		var cells = temprow.cells;
		
		var cell = cells[0];
		
		if(typeof(cell) == 'object')
		{
			cell.innerText = deletepos-1;
			deletepos++;
		}
	}	

}

function checkFileType(obj){
	var submitstate = document.getElementById("status");
	if(submitstate.value != '3'){
	
		showmess("应答已经结束不能进行应答!");
		return 0;
	}
	if(change.distance <= 0 ){
	
		showmess("应答已经过期不能进行应答!");
		return 0;
	}

	

	
	if(obj != null && typeof(obj) != "undefined"){

		var filePath = obj.value;    
	    var fileSystem = new ActiveXObject("Scripting.FileSystemObject");       
	    var file = fileSystem.GetFile (filePath);    
	    fileSize = file.Size;
	    if(fileSize > 1024*1024*20 ){
	    	showmess("需要加密的文件,文件大小不能超过20M!");
	    	return  0;
	    }
		
		if(obj.value != ""){
			var filetype = obj.value.substring(obj.value.lastIndexOf(".")+1,obj.value.length);
			 if(filetype == "zip" || filetype == "rar"){
				 return 1;
			 }
		}
	}

	
	
	showmess("请选择文件类型为rar或zip的压缩文件进行加密!");
	return  0;
}

function schange(obj,strmicontent,strSignature){

	    var msg = "";
		if(obj != null && typeof(obj) != "undefined"){
			
			if(obj.value != ""){
			var filetype = obj.value.substring(obj.value.lastIndexOf(".")+1,obj.value.length);
			var msgshow = document.getElementById("msgid");
			msgshow.innerHTML = "<p></p>";
	        if(filetype == "zip" || filetype == "rar"){
	                 //把文件的路径进行截取显示文件的名称
	             var filepath =  obj.value.substring(0,obj.value.lastIndexOf("\\")+1);
	             //msg += "文件路径:"+filepath;
	             //设置文件名称
	             var filename = obj.value.substring(obj.value.lastIndexOf("\\")+1,obj.value.lastIndexOf("."));
	             //msg += "<br>文件名称:"+filename;
	             //msg += "<br>文件类型:"+filetype;
	             var randomApp = ranMsg.birthRandom(filename,filetype,strSignature);
	             createFileMsg(strmicontent,filepath,filename+"_"+randomApp+"."+filetype);
	             //msg += "<br>文件 \""+filename+"\" 加密成功!";
	             msg += "生成加密后的文件为:"+filepath+filename+"_"+randomApp+"."+filetype;
	             msgshow.innerHTML = msg;
	             
	             
	             
	         }else{
	            
	            msgshow.innerHTML = "此文件的文件类型为"+filetype+",请选择文件类型为rar或zip的压缩文件进行加密!";
	         }
			}
			

		
		}
	}


	function createFileMsg(msg,filepath,filename){

		var fso, f;
		fso = new ActiveXObject("Scripting.FileSystemObject");
		f = fso.CreateTextFile(filepath+filename, true);
		f.WriteLine(msg);
		f.Close();
	}


	function onsrcFileChange(fileobject,index){

		var filetype = fileobject.value.substring(fileobject.value.lastIndexOf("\\")+1,fileobject.value.length);

		var signmsg = ranMsg.getSignMsg(filetype);

		if(signmsg == ""){
			deleteRow(index);
			showmess("请选择加密文件!");
			return;
		}
		
		ondatachange(fileobject,index,signmsg,null);
	}

	function FileChange(fileobject,index){

		//ondatachange(fileobject,index);
		
		var status = document.getElementById("status");
		var pub_types = document.getElementsByName("pub_type");
		//判断供应商是否在使用状态
		if(update_mode != '1')
		{
				showmess("供应商已经被淘汰或是废弃不能添加报价信息!");
				return;
		}

		if(pub_types != null && typeof(pub_types) == 'object'){

			var length = pub_types.length;
			for(var indexs=0; indexs<length; indexs++){

					if(pub_types[indexs].value == ''){
						deleteUpRow("row"+index);
						showmess("请选择上传附件类型!");
						return;
					}
			}
		}
		
		//判断文件对象的值是否为空
		if(fileobject.value != null && fileobject.value != "")
		{
			var fileType = fileobject.value.substring(fileobject.value.lastIndexOf(".")+1,fileobject.value.length);
			//判断文件的大小
			var filePath = fileobject.value;    
		      var fileSystem = new ActiveXObject("Scripting.FileSystemObject");       
		      var file = fileSystem.GetFile (filePath);    
		      fileSize = file.Size;
		
			if((fileType == "zip" || fileType == "rar" || fileType == "7z" ) && fileSize < 1024*1024*30 ){
			//获取对应文件所在的位置
			 var row = document.all("row"+index);
			 
			 var cells = row.cells;
			 var cell = cells[1];
			 
			 //把文件的路径进行截取显示文件的名称
			 cell.innerHTML =  fileobject.value.substring(fileobject.value.lastIndexOf("\\")+1,fileobject.value.lastIndexOf("."));
			 
			 var filename = document.all("filename"+index);
			 //设置文件名称
			 filename.value = fileobject.value.substring(fileobject.value.lastIndexOf("\\")+1,fileobject.length);
			 //隐藏掉上传文件按钮
			 var img = document.all("img"+index);
			 
			 img.style.visibility = "hidden";
			 fileobject.style.display = "none";

			 parent.showHideFun();
				parent.changeShowMessage("附件处理中,请等候.....");
		 	//var pk_xy_proj_main = document.getElementById("pk_xy_proj_main");
			//var pk_xy_step_pub = document.getElementById("pk");
			var url = "other.do?type=10&pk_xy_proj_main=${pk_xy_proj_main}&pk=${pk}";
			//document.insertPriceItemForm.action = url;
			//document.insertPriceItemForm.submit;
			document.submitdata.action = url;
			document.submitdata.submit();
			 
			 }else{
				 deleteUpRow("row"+index);
			 	showmess("请上传文件类型为rar、zip、7z文件，且文件大小不能超过30M");
			 }
			 
		}
	}

</script>
</body>
</html>
